//
//  LYDTabBarViewController.m
//  20150809生活圈
//
//  Created by yons on 15/8/10.
//  Copyright (c) 2015年 iron. All rights reserved.
//

#import "LYDTabBarViewController.h"
#import "LYDPopView.h"
#import "LYDTabBarView.h"
#import "LYDTabBarViewAndPopViewDelegate.h"
@interface LYDTabBarViewController () <LYDTabBarViewAndPopViewDelegate>

@property (nonatomic, strong) LYDTabBarView *tabBarView;

@property (nonatomic, strong) LYDPopView *popView;

@end

@implementation LYDTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.tabBar.hidden = YES;
    _tabBarView = [[LYDTabBarView alloc] init];
    _tabBarView.frame = CGRectMake(0, UIScreenHeight - tabBarHeight, UIScreenWidth, tabBarHeight);
    _tabBarView.delegate = self;
    [self.view addSubview:_tabBarView];
    aaaazzzzccc
    _popView = [[LYDPopView alloc] init];
    _popView.frame = CGRectMake(0, UIScreenHeight - tabBarHeight - PopViewHeight, UIScreenWidth, PopViewHeight);
    _popView.delegate = self;
    _popView.hidden = YES;
    [self.view addSubview:_popView];
    
}

- (void)tabBarViewWhenPushHidden:(BOOL)isHidden
{
    if (isHidden) {
        self.tabBarView.hidden = YES;
    }
    else
    {
        self.tabBarView.hidden = NO;
    }
    
}

#pragma mark - LYDTabBarView delegate

- (void)changeControllerWithButton:(UIButton *)btn
{
    NSLog(@"%zd",btn.tag);
    if (btn.tag < 4) {
        self.selectedViewController = self.viewControllers[btn.tag];
    }
    else if(btn.tag == 4)
    {
        self.popView.hidden = NO;
    }
    else if(btn.tag == 8)
    {
        self.popView.hidden = YES;
    }
    else if(btn.tag > 4)
    {
        self.selectedIndex = btn.tag - 1;
    }
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
